//
//  CYShopCartAuotCellHight.m
//  CaiYun
//
//  Created by 今日信息科技 on 2017/9/20.
//  Copyright © 2017年 今日信息科技. All rights reserved.
//

#import "CYShopCartAuotCellHight.h"
#import "CYSelectLotteryModel.h"
@implementation CYShopCartAuotCellHight
+ (NSArray *)cellHights:(NSArray *)array{
    
    CGFloat table_width = SCREEN_WIDTH - AL(PT(42)) * 2 - AL(8);//tableview的宽度 cell的宽度
    UIFont *font = [UIFont systemFontOfSize:AL(PT(26))];//字体
    NSDictionary *attribute = @{NSFontAttributeName:font};//label的字体
    CGFloat text_H = [@"五星" sizeWithAttributes:attribute].height;//任意的一个汉字的label的高度
    CGFloat offset_H = AL(PT(10)) * 3;//label之间的纵向间距
    CGFloat number_width = table_width - AL(PT(40));//number的label的宽度
    
    NSMutableArray *mutableArr = [NSMutableArray array];
    
    for (CYSelectLotteryModel *model in array) {
        NSString *number = [NSString specialStringWithArray:[model.actionData componentsSeparatedByString:@","] arrayCharacter:@"   |   " stringCharacter:@","];//号码
        CGSize number_size = [number boundingRectWithSize:CGSizeMake(number_width, MAXFLOAT) options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading attributes:attribute context:nil].size;
        CGFloat number_H = ceil(number_size.height);//number的label的高度
        
        CGFloat total_H = ceil(number_H + text_H + offset_H);
        
        [mutableArr addObject:[NSString stringWithFormat:@"%f",total_H]];
        
    }
    return mutableArr;
}

+ (NSMutableDictionary *)insertBetWay:(NSDictionary *)dict playGroupName:(NSString *)playGroupName playName:(NSString *)playName{
    
    NSMutableDictionary * mutableDic = [NSMutableDictionary dictionaryWithDictionary:dict];

    for (NSDictionary *subDic in mutableDic[@"code"] ) {
        if (![[subDic allKeys] containsObject:@"playGroupName"])
            [subDic setValue:playGroupName forKey:@"playGroupName"];
        if (![[subDic allKeys] containsObject:@"playName"])
            [subDic setValue:playName forKey:@"playName"];
    }
    
    return mutableDic;
}
@end
